<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>component-1 全局组件和局部组件</title>
    <script src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>component-1 全局组件和局部组件</h1>
    <hr/>
    <div id="app">
        <superbone></superbone>
        <laofu></laofu>
    </div>

    <script>

        //这里定义全局组件.每个vue对象都会包含这个组件
        Vue.component('superbone',{
            template: `<div style="color:red">我是全局的superbone组件</div>`
        })

        var app = new Vue({
            el: '#app',
            data: {
            },

            //这里指定的是局部组件.只会在当前的vue实例中出现
            components: {
                laofu: {
                    template: `<div style="color:green">我是局部的laofu组件</div>`
                }
            }
        });
    </script>

</body>
</html>